/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author egov
 */
@Entity
@Table(name = "ALBUM")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Album.findAll", query = "SELECT a FROM Album a"),
    @NamedQuery(name = "Album.findByAlbid", query = "SELECT a FROM Album a WHERE a.albid = :albid"),
    @NamedQuery(name = "Album.findByDisknumber", query = "SELECT a FROM Album a WHERE a.disknumber = :disknumber"),
    @NamedQuery(name = "Album.findByReleasedate", query = "SELECT a FROM Album a WHERE a.releasedate = :releasedate"),
    @NamedQuery(name = "Album.findByTitle", query = "SELECT a FROM Album a WHERE a.title = :title"),
    @NamedQuery(name = "Album.findByType", query = "SELECT a FROM Album a WHERE a.type = :type")})
public class Album implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ALBID")
    private Long albid;
    @Basic(optional = false)
    @Column(name = "DISKNUMBER")
    private int disknumber;
    @Basic(optional = false)
    @Column(name = "RELEASEDATE")
    private String releasedate;
    @Basic(optional = false)
    @Column(name = "TITLE")
    private String title;
    @Basic(optional = false)
    @Column(name = "TYPE")
    private String type;
    @ManyToMany(mappedBy = "albumList")
    private List<Song> songList;
    @JoinColumn(name = "MUSICPRODUCTIONCOMPANY_ID", referencedColumnName = "MPCID")
    @ManyToOne(optional = false)
    private Musicproductioncompany musicproductioncompanyId;
    @JoinColumn(name = "MUSICGROUP_ID", referencedColumnName = "MGRID")
    @ManyToOne
    private Musicgroup musicgroupId;
    @JoinColumn(name = "ARTIST_ID", referencedColumnName = "ARTID")
    @ManyToOne
    private Artist artistId;

    public Album() {
    }

    public Album(Long albid) {
        this.albid = albid;
    }

    public Album(Long albid, int disknumber, String releasedate, String title, String type) {
        this.albid = albid;
        this.disknumber = disknumber;
        this.releasedate = releasedate;
        this.title = title;
        this.type = type;
    }

    public Long getAlbid() {
        return albid;
    }

    public void setAlbid(Long albid) {
        this.albid = albid;
    }

    public int getDisknumber() {
        return disknumber;
    }

    public void setDisknumber(int disknumber) {
        this.disknumber = disknumber;
    }

    public String getReleasedate() {
        return releasedate;
    }

    public void setReleasedate(String releasedate) {
        this.releasedate = releasedate;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @XmlTransient
    public List<Song> getSongList() {
        return songList;
    }

    public void setSongList(List<Song> songList) {
        this.songList = songList;
    }

    public Musicproductioncompany getMusicproductioncompanyId() {
        return musicproductioncompanyId;
    }

    public void setMusicproductioncompanyId(Musicproductioncompany musicproductioncompanyId) {
        this.musicproductioncompanyId = musicproductioncompanyId;
    }

    public Musicgroup getMusicgroupId() {
        return musicgroupId;
    }

    public void setMusicgroupId(Musicgroup musicgroupId) {
        this.musicgroupId = musicgroupId;
    }

    public Artist getArtistId() {
        return artistId;
    }

    public void setArtistId(Artist artistId) {
        this.artistId = artistId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (albid != null ? albid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Album)) {
            return false;
        }
        Album other = (Album) object;
        if ((this.albid == null && other.albid != null) || (this.albid != null && !this.albid.equals(other.albid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Album[ albid=" + albid + " ]";
    }
    
}
